
def merge(lyst, low, mid, high):
    i = low
    j = mid + 1
    ltmp = []
    while i <= mid and j <= high:   # 只要左右两边都有数
        if lyst[i] < lyst[j]:
            ltmp.append[lyst[i]]
            i += 1
        else:
            ltmp.append(lyst[j])
            j += 1
    # while执行完肯定有一部分没数了
    while i <= mid:
        ltmp.append[lyst[i]]
        i += 1
    while j <= high:
        ltmp.append[lyst[j]]
        j += 1

    lyst[low: high+1] = ltmp

def merge_sort(lyst, low, high):
    if low < high:  # 至少有两个元素
        mid = (low + high) // 2
        merge_sort(lyst, low, mid)
        merge_sort(lyst, mid+1, high)
        merge(lyst, low, mid, high)